# coding:utf-8
class Admin::TelevisionsController < AdminController

  respond_to :html, :json

  set_tab :programs
  set_tab :tv, :sub_nav
  before_filter :setup, only: [:index]

  def index
    @televisions = Television.all
  end

  def edit
    @television = Television.find params[:id]
  end

  def show
    @television = Television.find params[:id]
  end

  def new
    @television= Television.new
  end

  def create 
    @television = Television.new params[:television]
    if @television.save
      redirect_to admin_televisions_path
    else
      render :action => :new 
    end
  end

  def update
    @television = Television.find params[:id]
    if @television.update_attributes(params[:television])
      redirect_to admin_televisions_path
    else
      render :action => :edit 
    end
  end

  def destroy
    @television = Television.find params[:id]
    @television.destroy
  end

  private

  def setup
    @ways = ["电台节目","EPG管理"]
    @left_panel = "admin/programs/left_panel"
  end

end
